package com.ymatou.app.rec.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*视频直播搜索接口Call
*FreeMaker Template自动生成代码
*/
public class c2cLiveIndexBizerCall extends YmatouBaseCall{
	private static String opurl ="c2clive/_search";
	public c2cLiveIndexBizerCall() {
		super(EnvSetup.getSystemUrl("c2cLiveIndexBizer"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取total
	 * 
	 * @return
	 */
	public int getTotal() {
		int total = 0;
		try {
			total = Integer.valueOf(new JSONObject(getReturnData())
					.getString("total"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return total;
	} 
	
	/**
	 * 获取hits列表
	 * 
	 * @return 
	 */
	public JSONObject getData() {
		JSONObject Data = null;
		try {
			Data = new JSONObject(getReturnData()).getJSONObject("hits");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Data;
	}
	
	/**
	 * 获取hit列表中的第一条记录
	 * @return object
	 * 
	 * *//*
	public JSONObject getHitsOne(){
		JSONObject DataOne = null;
		DataOne = new 
		return null;
		
	}*/
	
}